{extend name="public/basic"}
{block name="main"}
<form class="layui-form ajax" method="post" action="{if condition="isset($data.id)"}{:url('home/Menu/go_edit','id='.$data['id'])}{else /}{:url('home/Menu/go_add')}{/if}">
    <div class="layui-form-item">
        <label class="layui-form-label"> 上级 </label>
        <div class="layui-input-block">
            <select name="menu_pid">
                <option value="0">作为顶级菜单</option>
                {$menulist}
            </select>
         </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="输入名称" required lay-verify="required" name="name" value="{$data.name|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" > 应用 </label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="输入应用" required lay-verify="required" name="model" value="{$data.model|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 控制器 </label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="输入控制器" required lay-verify="required" name="controller" value="{$data.controller|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 方法 </label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="输入方法" required lay-verify="required" name="action" value="{$data.action|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 参数</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="输入参数" name="data" value="{$data.data|default=''}">
        </div>
        <span>例:id/3/p/3</span>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 排序 </label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="排序" name="listorder" value="{$data.listorder|default='0'}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 类型 </label>
        <div class="layui-input-block">
            <select name = "option">
                <option value = "menu" {if condition="isset($data['option']) and $data.option eq 'menu'"}selected{/if}>菜单</option>
                <option value = "button" {if condition="isset($data['option']) and $data.option eq 'button'"}selected{/if}>按钮</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 层级 </label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="如果是菜单，请选填写层级" name="level" value="{$data.level|default='1'}">
        </div>
    </div>
     <div class="layui-form-item">
        <label class="layui-form-label"> 备注 </label>
        <div class="layui-input-block">
            <textarea class="layui-textarea" name="remark" placeholder="输入备注">{$data.remark|default=''}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label" > 是否显示 </label>
        <div class="layui-input-block">
        {if condition="isset($data.id)"}
        {if condition="$data.status eq 1"}<input type="checkbox" name="status" lay-skin="switch" checked>{else /}<input type="checkbox" name="status" lay-skin="switch">{/if}
        {else /}
        <input type="checkbox" name="status" lay-skin="switch" checked>
        {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> 类型 </label>
        <div class="layui-input-block">
            <select name="type" >
                {if condition="isset($data.id)"}
                {if condition="$data.type eq 1"}
                <option value="1" selected>权限认证+菜单</option>
                <option value="0">只作为菜单</option>
                {else /}
                    {if condition="$data.type eq 2"}
                <option value = "2" selected>前台顶部菜单</option>
                <option value = "3">前台左侧菜单</option>
                    {else/}
                        {if condition="$data.type eq 3"}
                    <option value = "2" >前台顶部菜单</option>
                    <option value = "3" selected>前台左侧菜单</option>
                        {else/}
                    <option value="1">权限认证+菜单</option>
                    <option value="0" selected>只作为菜单</option>
                        {/if}
                    {/if}
                {/if}
                {else /}
                    {if condition = "$type eq 2"}
                <option value = "2" selected>前台顶部菜单</option>
                <option value = "3">前台左侧菜单</option>
                    {else /}
                <option value="1" selected>权限认证+菜单</option>
                <option value="0">只作为菜单</option>
                    {/if}
                {/if}
            </select>
         </div>
    </div>
    <div class="layui-form-item">
        <button class="layui-btn layui-btn-success" type="submit">
            <i class="layui-icon layui-icon-ok"></i> 保存
        </button> &nbsp; &nbsp; &nbsp;
        {if condition="isset($data.mb_id)"}
        <button class="layui-btn layui-btn-primary" type="reset" onclick="history.go(-1);">
            <i class="layui-icon layui-icon-prev"></i> 返回
        </button>
        {else /}
        <button class="layui-btn layui-btn-primary" type="reset">
            <i class="layui-icon layui-icon-refresh"></i> 重置
        </button>
        {/if}
    </div>
</form>
{/block}


